System with multiple conditional commit databases

ABSTRACT

A system for processing a transaction is disclosed. The system comprises a processor and a memory. The processor is configured to check a condition using data in a first database, wherein the data is associated with a transaction, wherein the data in the first database is latched before checking the condition and is unlatched after checking the condition. The processor is further configured to indicate to a second database to check the condition using data in the second database, wherein the data is associated with the transaction. The data in the second database is latched before checking the condition and is unlatched after checking the condition. The memory is coupled to the processor and configured to provide the processor with instructions.

CROSS REFERENCE TO OTHER APPLICATIONS

This application is a continuation of co-pending U.S. patent applicationSer. No. 12/661,897, entitled SYSTEM WITH MULTIPLE CONDITIONAL COMMITDATABASES filed Mar. 24, 2010 which is incorporated herein by referencefor all purposes.

BACKGROUND OF THE INVENTION

High availability of data or redundancy for failure situations can beachieved with databases by having multiple databases store the samevariables and values in those variables. Database data where the samevariables are stored by multiple databases typically requires lockingand/or establishing an owner in order to maintain synchronization of thevariables between the multiple databases. For example, a locking of agiven variable in all the multiple databases except for an owner who isaccessing or modifying the given variable and then propagating anychange to the given variable before unlocking. However, the locking ofthe variables and the propagating of the values creates overhead in thesystem and can lead to deadlocks in processing data in the databasesparticularly when more than one requested transaction requires a singlegiven variable or value within the variable.

BRIEF DESCRIPTION OF THE DRAWINGS

Various embodiments of the invention are disclosed in the followingdetailed description and the accompanying drawings.

FIG. 1A is a block diagram illustrating an embodiment of a system withmultiple conditional commit databases.

FIG. 1B is a block diagram illustrating an embodiment of a databasesystem.

FIG. 1C is a block diagram illustrating an embodiment of a serversystem.

FIG. 1D is a time line illustrating an embodiment of a prior arttransaction process.

FIG. 1E is a time line illustrating an embodiment of a prior arttransaction process.

FIG. 1F is a time line illustrating an embodiment of a transactionprocess.

FIG. 1G is a time line illustrating an embodiment of a transactionprocess.

FIG. 2A is a flow diagram illustrating an embodiment of a process for asystem for multiple conditional commit databases.

FIG. 2B is a flow diagram illustrating a process for implementing aprepare state.

FIG. 2C is a flow diagram illustrating a process for implementing acommit state.

FIG. 3 is a flow diagram illustrating an embodiment of a process for asystem with multiple conditional commit databases.

FIG. 4A is a flow diagram illustrating an embodiment of a process fordetermining a routing.

FIG. 4B is a flow diagram illustrating an embodiment of a process fordetermining a routing.

FIG. 5 is a flow diagram illustrating an embodiment of a process forpreparing a transaction.

FIG. 6A is a flow diagram illustrating an embodiment of a process forsending out an indication of a prepare transaction.

FIG. 6B is a flow diagram illustrating an embodiment of a process forsending out an indication of a prepare transaction.

FIG. 7A is a flow diagram illustrating an embodiment of a process forsending out an indication of a commit transaction.

FIG. 7B is a flow diagram illustrating an embodiment of a process forsending out an indication of a commit transaction.

FIG. 8 is a block diagram illustrating an embodiment of an updatebuffer.

FIG. 9 is a block diagram illustrating an embodiment of a transactionbuffer.

FIG. 10 is a block diagram illustrating an embodiment of a balance entryin a database.

DETAILED DESCRIPTION

The invention can be implemented in numerous ways, including as aprocess; an apparatus; a system; a composition of matter; a computerprogram product embodied on a computer readable storage medium; and/or aprocessor, such as a processor configured to execute instructions storedon and/or provided by a memory coupled to the processor. In thisspecification, these implementations, or any other form that theinvention may take, may be referred to as techniques. In general, theorder of the steps of disclosed processes may be altered within thescope of the invention. Unless stated otherwise, a component such as aprocessor or a memory described as being configured to perform a taskmay be implemented as a general component that is temporarily configuredto perform the task at a given time or a specific component that ismanufactured to perform the task. As used herein, the term ‘processor’refers to one or more devices, circuits, and/or processing coresconfigured to process data, such as computer program instructions.

A detailed description of one or more embodiments of the invention isprovided below along with accompanying figures that illustrate theprinciples of the invention. The invention is described in connectionwith such embodiments, but the invention is not limited to anyembodiment. The scope of the invention is limited only by the claims andthe invention encompasses numerous alternatives, modifications andequivalents. Numerous specific details are set forth in the followingdescription in order to provide a thorough understanding of theinvention. These details are provided for the purpose of example and theinvention may be practiced according to the claims without some or allof these specific details. For the purpose of clarity, technicalmaterial that is known in the technical fields related to the inventionhas not been described in detail so that the invention is notunnecessarily obscured.

A system for processing a transaction is disclosed. The system comprisesa processor and a memory. The processor is configured to check acondition using data in a first database, wherein the data is associatedwith a transaction, wherein the data in the first database is latchedbefore checking the condition and is unlatched after checking thecondition. The processor is further configured to indicate to a seconddatabase to check the condition using data in the second database,wherein the data is associated with the transaction. The data in thesecond database is latched before checking the condition and isunlatched after checking the condition. The memory is coupled to theprocessor and configured to provide the processor with instructions.

A system with multiple conditional commit databases is disclosed. Asystem for processing a transaction comprises a processor, an interface,and a memory. The processor is configured to execute locally a conditioncheck of a transaction based on a locally stored version of a variable.The interface is configured to indicate the condition check of thetransaction to other servers to be done using a locally stored versionof the variable. The processor is further configured to determinewhether to proceed with the transaction based on results of thecondition check of the transaction. The memory is coupled to theprocessor and configured to provide the processor with instructions.

In some embodiments, multiple servers storing the same data areavailable to process transactions and/or requests. A query is routed toone of the servers for processing. Because a conditional commit databaseallows access to data at almost all times even when the data is beingused/potentially modified by a transaction associated with anotherquery, each individual server and all of the multiple servers havealmost no restrictions to processing a query because a data/variable isinaccessible due to another query. The ability of the conditional commitdatabase to allow access is based on the design of the database whichallows transactions to process as long as conditions are met (e.g., aslong as a phone account balance has more than 100 minutes allow call toproceed). In various embodiments, a query comprises a) requestingpermission to grant service to a subscriber based on their availablebalances and credit; b) after providing network access (e.g., grantingservice), requesting for charging for a service that has been provided;or any other appropriate query. The conditional commit database alsoallows latching of data in a database for extremely short periods oftime around data accessing and data updating. For example, precisesynchronization of data in all databases is not an absolute requirement;rather conditions associated with a transaction must be met (e.g.,balance greater than $50 or balance more than 100 minutes, etc.), andthis enables restricting access to the data only around access times forthe data not during the entire time of the transaction or the time todetermine a response to a query. In some embodiments, latching securesexclusive access to data for an atomic region of computer instructionsthat contains no external communications or references (as opposed tolocking, where exclusive access is held across external communicationsor references), and therefore executes at full speed without waiting forcompletion of any external event.

Although the specific examples sometimes involve balances and anapplication of the system for multiple conditional commit databases forprocessing transactions associated with billing for phone usage, thesystem is equally applicable to other data types and other types oftransaction processing. For example, the system can support applicationsto process financial payments, fraud detection, mediation, settlementcalculations, etc.

FIG. 1A is a block diagram illustrating an embodiment of a system withmultiple conditional commit databases. In the example shown, a query isprocessed by query router 125. For example, a query comprises a requestby a network to see if a user (e.g., John Doe) is allowed to use aservice—make a call, send a text message, use a data network, etc.Routing is determined in order to evenly distribute load across theservers. For example, a query is routed to a server to distribute loadevenly and/or a query is not distributed to a server that is notavailable (e.g., fully loaded, not connected, undergoing maintenance,etc.). In various embodiments, distribution is based at least in part ondata in or data associated with the query (e.g., data embedded in thequery, data accessed as part of processing the query, etc.), on the typeof network event associated with the query (e.g., voice call, shortmessage service (SMS) message, data network interaction, etc.), on thesource of the event associated with the query (e.g., local subscriberusing a network, roaming user using a network, etc.), or based at leastin part on any other appropriate information associated with the query.In some embodiments, routing of a query is based at least in part on theloading of a server system in relation to the loading of another serversystem. Query router 125 determines a processing host system—forexample, one of a plurality of multiple systems represented in FIG. 1Aby server system 100, server system 110, or server system 120—for thereceived query. Each server system includes a conditional commitdatabase system—for example, server system 100 includes database system102; server system 110 includes database system 112; and server system120 includes database system 122. The conditional commit databasesystems hold the same data so that in the event that a system failsthere are redundant systems available to handle queries. A commit for adatabase update of a data entry stored in the database for a givenprocessing host is communicated to each of the other conditional commitdatabases and queued for commitment in each of the other databases. Insome embodiments, although all of the databases receive each data entryupdate, a given database processes database updates in a different orderfrom another database, in which case the data in all the databases arenot exactly synchronized for a short period of time. In someembodiments, in the event that two transactions pass each otherresulting in an order for the transactions (e.g., a commit order) on oneserver that is ambiguous or not the same as other servers, thetransactions are aborted and the two transactions are retried. In someembodiments, in the event that two transactions pass each otherresulting in an order for the transactions (e.g., a commit order) on oneserver that is ambiguous or not the same as other servers, thetransactions are allowed to proceed and the databases are momentarilyout of synchronization, then achieve synchronization again once bothtransactions have been committed on both servers. In some embodiments, atransaction indicates in a prepare message sent from a server that the8^(th) dollar needs to be deducted from the balance, and a remote serversays that you can have a dollar from the balance (e.g., the balance issufficient to deduct the dollar) but the 8^(th) dollar is not available.

In some embodiments, database data is divided into multiple types basedon the access patterns of the data. For instance, data may be dividedinto high update rate data (e.g. balances, which may have frequent andeven simultaneous updates) and low update rate data (e.g. customerprofile data, which typically has infrequent updates and almost neversimultaneous updates). For the example of a simultaneous update of abalance, it is straightforward to process the correct result (e.g.,subtract both, add both, subtract and add, etc.). However, for otherdata such as customer profile data, it is less obvious how to processthe correct results if simultaneous updates are allowed (e.g. in twosimultaneous updates each editing a list of calling group numbers forthe same customer, which version of the list is correct?) Also, itshould be noted that, in some embodiments, for a low update rate objectsuch as a customer profile that has many fields, building and using theinfrastructure to indicate which fields are to be updated by a giventransaction, which fields are currently in the process of being updatedby other transactions, and determining when two transactions' updatesmay proceed simultaneously may add overhead to processing thetransactions, and may not provide much value since the probability oftwo low update rate object transactions updating at the same time isextremely low. In all cases, when all queued committed updates to thedatabases are processed, all the databases will again be fullysynchronized.

The conditional commit databases do not lock data for the time duringwhich an application manipulates the data. The application can read,write, or otherwise access data in each of the databases even when otheroperations are active against the same data. A conditional write to anyone of the databases is enabled to allow an application to write to thedatabase in the event that one or more conditions on database entriesare met. For example, a write to a database entry is dependent onanother database entry's value having stayed the same, be above acertain value, having not changed more than a certain amount since aprior reading of a value, be below a certain value, having changed morethan a certain amount since a prior reading of a value, having beenwritten (or updated) since a prior reading, having been not written (ornot updated) since a prior specific reading, having been read or notread since a prior reading, having been written or not written since aprior specific writing, having been read or not read since a priorwriting, or any other appropriate condition. A conditional commitdatabase can then reduce, if not eliminate, overheads associated withaccess locking A situation where multiple accesses to a data entry mayor may not impact an application's interaction with a conditional commitdatabase data entry are handled using the conditional update. In theevent that a conditional commit database entry does not satisfy thecondition associated with the conditional update, then the applicationcan restart the process or calculation for the associated databaseentries. For a conditional commit database where the probability of aproblem situation arising from inappropriate access of database entriesby applications is low, then database overheads for access locking arereduced or eliminated for all database interactions in favor of handlingthe retry of a conditional update command only in the low probabilityevent that a condition is not met. The conditional commit technologyalso enables multiple system database architectures where operation(e.g., previously locking operations) across databases is required. Theshorter the locking, or lack of locking, for multiple systemarchitectures the less likely that performance issues will arise due tothe tracking and synchronization requirements of the multi-server locks(e.g., blocking other operations on the database while waiting for alock to be released on a data—for example, multiple operations need toaccess a single account and all operations are forced to wait in asingle file line to execute because each operation locks the data forthe single account).

In some embodiments, the conditional commit enables faster processing ofa database system. Typically, database systems ensure that commits aremade without any corruption to data involved in the commit by lockingthe involved data. The overhead required for this slows processing byusing processing cycles to track the involved data and queue anyprocesses that want to access involved data. These overheads can, insystems with a high number of transactions to process, significantlydegrade overall performance. Eliminating the overheads and allowing somepotential corruption of data can speed the system. In some embodiments(e.g.—network traffic pattern analysis), this small potential for datacorruption is acceptable. In some embodiments (e.g. financialtransactions), no potential corruption of the data is tolerable. Inthese cases, in the event that data would be corrupted (e.g., adetection is made that data is corrupted by an upcoming transaction), adata update or other data process is aborted and the update or otherprocess is redone (e.g., recalculated and/or resubmitted). Potentialcorruption of data is detected using the conditions placed on thecommits. The effects of the potential corruption of data can becorrected, if necessary (e.g., if the condition is not met), byrecalculating and resubmitting. For example, a user (e.g., Joe) istrying to make a phone call; a query is sent to request approval; theCharge Server converts the query into a transaction in the databasereserving or charging for the use of resources (e.g., Joe's resources);the database indicates that this should be OK; an attempt is made toreserve the time for the call (e.g., 5 minutes); if the reservation isOK, then the user is approved; if the reservation is not then thereservation is aborted; in a loop between the Charge Server and theTransaction Server, a determination ends up being made that a call forso long is possible and approved and this is sent back as a response tothe initial query. For scenarios, where potential corruption occurrencesare very rare, the system can process transactions faster and achievehigher transaction volumes.

In various embodiments, a database has a read lock (e.g., no access isallowed to each of the multiple items for other read/write requestsduring a requested read of the multiple items) or has no read lock(e.g., access is allowed to any item for other read/write requestsduring a read request for multiple items).

In various embodiments, data in the database comprises numbers, strings,dates, times, bytes, floating point values, or any other appropriatedata.

In some embodiments, the databases in the server systems (e.g., database102 in server system 100, database system 112 in server system 110, anddatabase 122 in server system 120) keep in synchronization with eachother by sending messages/instructions between each other to ensuresynchronization of data. For example, synchronization steps include alocal prepare, a remote prepare, a local commit and a remote commitstep. Local prepare tests the transaction conditions locally and createslocal transactional state so any other queries being processed on thesame server will know this update is pending. Remote prepare tests thetransaction conditions on each of the remote database systems andcreates transactional state in each of those database systems so anyqueries being processed on remote servers will know this update ispending. Local commit irrevocably logs the transaction as committed andupdates the local data to a new value. Remote commit updates each remotecopy of the data to a new value.

In some embodiments, 1) a transaction comes in; 2) a local prepare isperformed (e.g., data associated with the transaction is latched—datathat has a condition or is being updated such as a balance data; thecondition(s) associated with the transaction are checked locally; in theevent that a conditions(s) does not pass, then the transaction isaborted; in the event that the conditions(s) pass, then the transactionbuffer and update buffer(s) are set up (e.g., the transaction buffer isallocated or modified if already allocated and an update buffer for eachdata to be updated is allocated); the data associated with thetransaction is unlatched); and 3) the prepare is then caused to beperformed in the other databases (e.g., a message to perform the prepareis sent out to all other servers, individual messages to perform theprepare are sent out to other servers, or the remote operations for theprepare are performed on the remote database using the local processor)where the remote prepare includes latching, checking the condition(s),setting up a transaction buffer and update buffer(s), unlatching, andsending a message back that the prepare passed or failed; the localserver waits for all the remote servers to get back their pass/failstatus (e.g., a checklist is kept locally regarding the status of theprepare at the remote sites).

In some embodiments, in the event of a unanimous pass, the transactionis logged to disk (note that this is the moment of commit), a localcommit is performed (e.g., all data associated with the transaction islatched again; the update of the data associated with the transaction isperformed; the transaction buffer and the update buffer(s) are updatedto reflect the commit; and the data associated with the transaction isunlatched), the commit is then caused to be performed on the otherservers (e.g., a message is multicast out to cause the other servers toperform a commit, a message is sent to each and every other server toperform a commit, or a commit is performed using the local processor andthe remote database) where the remote commit comprises similar steps toa local commit (e.g., latching, updating the data, updating thetransaction buffer and the update buffer(s) to reflect the commit, andunlatching); a message is sent back from each remote server and/ordatabase to indicate that the commit was completed. In variousembodiments, the remote commit comprises deallocating the transactionbuffer instead of updating the transaction buffer, not logging to disk,or any other appropriate processes for a remote commit. In someembodiments, there is a separate cycle after the commit cycle thatcleans up the transaction buffers on the local and remote servers.

In some embodiments, in the event that there is not a unanimous pass, alocal abort is performed (e.g., latching of the associated data,reverting of the update buffer to a state prior to the prepare, andunlatching of the data); an abort is caused to be performed on theremote servers (e.g., a multicast abort message is sent, an abort issent to each remote server, or an abort is caused using a localprocessor for the remote server); the local server waits until theresponses from all the remote servers indicates that the remote servershave aborted; in the event that all the remote servers have aborted,then the local transaction buffer is deallocated or taken apart; in theevent that not all of the remote servers indicate a successful abort hasbeen performed, then an analysis is performed to determine whether theremote server has malfunctioned or has any other problems.

In some embodiments, the multiple servers (e.g., server 100, server 110,and server 120) are connected to a communications bus. In variousembodiments, a database and an application exist on the same server, adatabase and an application do not exist on the same server, a connectedset of servers includes servers with both configurations (e.g.,application/database on a single server and separate servers forapplication and database), or any other appropriate configuration ofservers and functionality on the servers.

FIG. 1B is a block diagram illustrating an embodiment of a databasesystem. In some embodiments, server system 130, server system 140, andserver system 150 are used to implement server system 100, server system110, and server system 120, respectively. In the example shown, serversystem 130, server system 140, and server system 150 are connected tocommunication bus 154. Database 132, database 142, and database 152 areconnected to communication bus 154. In various embodiments, the numberof server systems is the same as the number of database systems, thenumber of server systems is greater than the number of database systems,or the number of server systems is less than the number of databasesystems.

In some embodiments, the databases in the server systems (e.g., database132 in server system 130, database system 142 in server system 140, anddatabase 152 in server system 150) keep in synchronization by havingeach server system synchronize data on all databases using communicationbus 154. For example, synchronization steps include a local prepare, aremote prepare, a local commit and a remote commit step. Local preparetests the transaction conditions locally and creates local transactionalstate so any other queries being processed on the same server will knowthis update is pending. Remote prepare tests the transaction conditionson each of the remote database systems and creates transactional statein each of those database systems so any queries being processed onremote servers will know this update is pending. Local commitirrevocably logs the transaction as committed and updates the local datato a new value. Remote commit updates each remote copy of the data to anew value.

FIG. 1C is a block diagram illustrating an embodiment of a serversystem. In some embodiments, application server system 170 is used toimplement server system 130, server system 140, and/or server system150. In some embodiments, database system 180 is used to implementdatabase system 102, database system 112, database system 122, databasesystem 132, database system 142, and/or database system 152. In theexample shown, application server system 170 comprises gateway 172 andcharge server 174. Gateway 172 interfaces with other servers to receivequeries. Charge server 174 calculates a charge associated with a query(e.g., a telephone charge associated with a call, a text charge for atext message, a data charge for a data message, etc.). Database systemcomprises transaction server 176, database storage 182, and loggingsystem 178. Transaction server 176 conveys information to logging system178 in order to log a transaction. Database storage 182 stores data(e.g., balance(s), customer data, charging information, etc.). A queryis received by gateway 172 (e.g., a query requesting a service, a calltime, a message, from a network, etc.). The query is translated byapplication server 170 so that charge server 174 determines appropriatecharge(s) and/or approval(s) for charge(s). Charge server 174 determinesthe appropriate charge(s) and/or approval(s) for charge(s) based atleast in part on request(s) to transaction server 176. Transactionserver 176 helps to determine appropriate charge(s) and/or approval(s)for charge(s) by checking data stored in database storage 182. Forexample, a balance is checked for a user requesting approval for a call(e.g., a certain number of minutes for a call). In some embodiments,transaction server 176 comprises a commit engine and an update handler,where the commit engine is used to commit a transaction on one or moredatabases and wherein the update handler handles update processing tothe database and database storage (e.g., database storage 182). Loggingsystem 178 logs a transaction (e.g.; a call charge is logged so that abill to a user can be determined).

FIG. 1D is a time line illustrating an embodiment of a prior arttransaction process. In the example shown, Client sends a query toApplication. Application receives query. Application sends OpenTransaction to Database 1. Database 1 receives Open Transaction.Database 1 sends an acknowledgement (e.g., ACK) to Application.Application receives ACK. Application sends read request to Database 1.Database 1 receives read request. Database 1 allocates transactioncontext. Database 1 locks data (e.g., data that is used in thecalculation step, data that is to be updated, etc.). Database 1 sends aLock Request to Database 2. Database 2 receives lock request. Database 2allocates transaction context. Database 2 locks data (e.g., data that isused in the calculation step, data that is to be updated, etc.).Database 2 sends ACK to database 1. Database 1 receives ACK fromdatabase 2. Database 1 sends result of read request to Application.Application uses the result to calculate or think regarding the receivedquery. Application sends update request to database 1. Database 1receives update request. Database 1 processes the update locally.Database 1 sends UPDATE to database 2. Database 2 receives UPDATE.Database 2 processes the update locally. Database 2 sends ACK todatabase 1. Database 1 receives ACK from database 2. Transaction processcontinues at marker A.

FIG. 1E is a time line illustrating an embodiment of a prior arttransaction process. In the example shown, database 1 sends ACK toApplication. Application receives ACK from database 1. Application sendsCOMMIT TXN (e.g., a commit transaction command) to database 1. Database1 receives COMMIT TXN. Database 1 processes a local PREPARE. Database 1sends PREPARE to database 2. Database 2 receives PREPARE from database1. Database 2 processes a local PREPARE. Database 2 sends ACK todatabase 1. Database 1 receives ACK from database 2. Database 1processes a local COMMIT. Database 1 sends COMMIT to database 2.Database 2 receives COMMIT from database 1. Database 2 processes a localCOMMIT. Database 2 unlocks data. Database 2 sends ACK to database 1.Database 1 receives ACK from database 1. Database 1 unlocks data.Database 1 sends COMMIT ACK to Application. Application receives COMMITACK from database 1. Application sends response to client and clientreceives response. Database 1 sends DONE to database 2 and database 2receives DONE from database 1. Database 1 removes transaction context.Database 2 removes transaction context. In some embodiments, thetransaction context comprises a transaction buffer and removal of thetransaction context comprises deallocation of the transaction buffer.Note that the updating within the prior art of FIGS. 1D and lE does notinclude preparing and committing of the transaction

FIG. 1F is a time line illustrating an embodiment of a transactionprocess. In the example shown, Client sends a query to Application.Application receives a query form Client. Application sends read requestto database 1. Database 1 receives read request from Application.Database 1 sends result to Application. Application receives result fromdatabase 1. Application thinks or calculates using result regarding thereceived query. Application sends update request to database 1. Database1 receives update request from Application. For the transaction processof FIGS. 1F and 1G, the update request comprises the transaction commit.Database 1 allocates transaction context. Database 1 processes a localPREPARE. Relevant data in database 1 is latched, not locked, during ashort window of the processing of the local PREPARE. Database 1 sendsUPDATE to database 2 (e.g., a command to process an update). Database 2receives UPDATE from database 1. Database 2 allocates transactioncontext. Database 2 processes a local PREPARE. Relevant data in database2 is latched, not locked, during a short window of the processing of thelocal PREPARE. Database 2 sends an ACK to database 1. Transactionprocess continues at marker B. In some embodiments, update request isinterpreted as “update this data and immediately commit the transaction”so the update request causes the PREPARE/COMMIT/DONE protocol to run inits entirety.

FIG. 1G is a time line illustrating an embodiment of a transactionprocess. In the example shown, database 1 processes a local COMMIT.Relevant data in database 1 is latched, not locked, during a shortwindow of the processing of the local COMMIT. Database 1 sends COMMIT todatabase 1. Database 2 receives COMMIT from database 1. Database 2processes a local COMMIT. Relevant data in database 2 is latched, notlocked, during a short window of the processing of the local COMMIT.Database 2 sends ACK to database 1. Database 1 receives ACK fromdatabase 2. Database 1 sends Update ACK to Application. Applicationreceives Update ACK from database 1. Application sends result to Client.Client receives result from Application. Database 1 sends DONE todatabase 2. Database 2 receives DONE from database 1. Database 1 removestransaction context. Database 2 removes transaction context. In someembodiments, the transaction context comprises a transaction buffer andremoval of the transaction context comprises deallocation of thetransaction buffer.

FIG. 2A is a flow diagram illustrating an embodiment of a process for asystem for multiple conditional commit databases. In the example shown,in 200 a transaction is received. In 202, a prepared state isimplemented for a first database. In some embodiments, the firstdatabase comprises a local database. In 204, a prepared state isimplemented for a second database. In some embodiments, the seconddatabase comprises a non-local database. In some embodiments, the seconddatabase is one of a plurality of non-local databases in which theprepared state is to be implemented. In various embodiments, theprepared stated is implemented using a first server processor, a secondserver processor, or any other appropriate local or non-local processor.In 206, a commit state is implemented for a first database (including,in some embodiments, logging the transaction). In some embodiments, thefirst database comprises a local database. In 208, a commit state isimplemented for a second database. In some embodiments, the seconddatabase comprises a non-local database. In some embodiments, the seconddatabase is one of a plurality of non-local databases in which theprepared state is to be implemented. In various embodiments, theprepared stated is implemented using a first server processor, a secondserver processor, or any other appropriate local or non-local processor.

FIG. 2B is a flow diagram illustrating a process for implementing aprepare state. In some embodiments, the prepare state is implementedlocally or non-locally. In the example shown, in 220 data is latched. In222, it is determined whether one or more conditions is/are valid. Invarious embodiments, there is one condition, there is a plurality ofconditions that all must be true, there are no conditions, there are anumber of conditions and a majority must be true, or any otherappropriate number of conditions and/or any other appropriate testsregarding the number of conditions. In the event that the one or moreconditions is/are not valid, in 224 the transaction is aborted. In theevent that the condition is valid, in 226 a transaction buffer is setup.In 228, update buffer(s) is/are setup. In some embodiments, updatebuffer(s) is/are allocated out of a pool or located in the event that anupdate buffer already exists. In 230, data is unlatched.

FIG. 2C is a flow diagram illustrating a process for implementing acommit state. In some embodiments, the commit state is implementedlocally or non-locally. In the example, shown, in 240 data is latched.In 242, data is updated. In 244, the update buffer is updated. In someembodiments, updating of the update buffer comprises updating the stateof the update buffer(s) to reflect a committed transaction (or thechange of state). In various embodiments, the update buffer isdeallocated as part of the updating, is not deallocated, or any otherappropriate action relating to the updating of the update buffer. In246, transaction buffer is updated. In various embodiments, thetransaction buffer is deallocated as part of the updating, is notdeallocated, or any other appropriate action relating to the updating ofthe transaction buffer. In 248, data is unlatched. In variousembodiments, an additional stage to commit is included in committing, anadditional done stage is included in committing, or any otherappropriate single or multistage commit is performed.

FIG. 3 is a flow diagram illustrating an embodiment of a process for asystem with multiple conditional commit databases. In the example shown,in 300 a routing is determined for a received query and the query isrouted. In some embodiments, there are multiple steps between the stepsshown in FIG. 3 including reading related data, calculating updates, andsubmitting update transaction. In 302, it is determined whethercondition(s) is/are met. In the event that conditions are not met, thenin 316, it is indicated that the transaction failed. In someembodiments, a condition is met when the condition is satisfied—forexample, a condition that requires that a balance (e.g., a balance isequal to $162) is greater than $150 is satisfied. In some embodimentsthe indication of transaction failure prompts a recalculation andresubmission of the query. In the event that the condition(s) is/aremet, then in 304 a transaction is prepared associated with the query. Insome embodiments, preparation of the transaction includes determiningone or more transaction data structures—for example, a transactionbuffer and/or update buffer(s). In 306, an indication of the preparedtransaction is sent out. For example the indication is sent to all otherdatabases/server systems. In various embodiments, the indication ismulticast, the indication is sent out to other systems one by one, theindication includes an instruction causing a prepare to execute on theremote server, the indication executes the prepare on the remote server,or any other appropriate indication. In 308, it is determined whetherall are OK with the prepared transaction. For example, each other serversystem indicates that prepare of the transaction is OK, and the serversystem keeps track to ensure that each other server system has indicatedtheir OK. In the event that all are not OK with the preparedtransaction, in 318 an indication that the transaction failed istransmitted.

In the event that all are OK with the prepared transactions, then in 310the transaction is committed. In some embodiments, the commitment of thetransaction comprises logging the transaction. In 312, an indication issent out of the transaction commit. In 314, it is determined whether allare OK with the transaction commit. In some embodiments, thedetermination of whether all other servers are OK with the commitincludes keeping track of received indications from each of the otherservers that the commit is OK. In the event that all are not OK with thetransaction commit, in 322 it is indicated that a server may havefailed. In the event that all are OK with the transaction, then in 320it is indicated that the transaction is finished.

FIG. 4A is a flow diagram illustrating an embodiment of a process fordetermining a routing. In some embodiments, the process of FIG. 4A isused to implement 300 of FIG. 3. In the example shown, in 400 datafields are determined that are to be accessed by a query. In 402, aserver is selected to process query based on data fields to be accessed.For example, a server is selected using a mapping between data fieldsassociated with query and a server (e.g., customers with a criteriainvolving last names—for example, beginning with letters A-E—areassociated with server 1, customers with a criteria involving customerID's—for example, ID number falling in the range 0-10000—are associatedwith server 2, calls originating in a region—for example, California—areassociated with server 6, calls that are roaming, etc.).

FIG. 4B is a flow diagram illustrating an embodiment of a process fordetermining a routing. In some embodiments, the process of FIG. 4A isused to implement 300 of FIG. 3. In the example shown, in 450 loading ofall servers are determined. In 452, a server is selected to processquery based on server loading. For example, a server is selected thathas the lowest processor loading, a server is selected that has thelowest data storage loading, etc.

In some embodiments, the server routing is random. In some embodiments,the server routing is according to a predetermined sequence.

FIG. 5 is a flow diagram illustrating an embodiment of a process forpreparing a transaction. In some embodiments, the process of FIG. 5 isused to implement 304 of FIG. 3. In the example shown, in 500 atransaction buffer is allocated for the query. In 502, update buffer(s)is/are allocated or located for the query. In 504, the transactionbuffer is filled in. In 506 the update buffer is filled in. In someembodiments, in the event that the transaction buffer and/or updatebuffer(s) is/are already allocated then the transaction buffer and/orupdate buffer(s) are updated appropriately In some embodiments, anupdate buffer is associated with a data that is to be updated or isassociated with a query.

FIG. 6A is a flow diagram illustrating an embodiment of a process forsending out an indication of a prepare transaction. In some embodiments,the process of FIG. 6A is used to implement 306 of FIG. 3. In theexample shown, in 600 a first server is selected. In 602, an indicationis sent of prepare transaction to selected server. In 604, it isdetermined whether there are any more servers. In the event that thereare more servers, in 606 a next server is selected. In the event thatthere are no more servers, the process ends.

FIG. 6B is a flow diagram illustrating an embodiment of a process forsending out an indication of a prepare transaction. In some embodiments,the process of FIG. 6B is used to implement 306 of FIG. 3. In theexample shown, in 650, an indication of a prepare transaction is sent toall servers using a multicast message.

FIG. 7A is a flow diagram illustrating an embodiment of a process forsending out an indication of a commit transaction. In some embodiments,the process of FIG. 7A is used to implement 312 of FIG. 3. In theexample shown, in 700 a first server is selected. In 702, an indicationis sent of a commit transaction to selected server. In 704, it isdetermined whether there are any more servers. In the event that thereare more servers, in 706 a next server is selected. In the event thatthere are no more servers, the process ends.

FIG. 7B is a flow diagram illustrating an embodiment of a process forsending out an indication of a commit transaction. In some embodiments,the process of FIG. 7B is used to implement 312 of FIG. 3. In theexample shown, in 750, an indication of a commit transaction is sent toall servers using a multicast message.

FIG. 8 is a block diagram illustrating an embodiment of an update bufferfor a set of data containing two numeric variables—gross and reserved.In the example shown, transaction buffer 800 includes: maximum grossvalue 802, minimum gross value 804, maximum reserved value 806, minimumreserved value 808, and number of transactions 810. Maximum gross value802 comprises the maximum possible value for the gross variable afterall outstanding transactions complete in any combination of commits andaborts. Minimum gross value 804 comprises the minimum possible value forthe gross variable after all outstanding transactions complete in anycombination of commits and aborts. Maximum reserved value 806 comprisesthe maximum possible value for the reserved variable after alloutstanding transactions complete in any combination of commits andaborts. Minimum reserved value 808 comprises the minimum possible valuefor the reserved variable after all outstanding transactions complete inany combination of commits and aborts. Number of transactions 810comprises a count of how many transactions are in process against thisset of data.

FIG. 9 is a block diagram illustrating an embodiment of a transactionbuffer. In the example shown, transaction 900 comprises participant list902, check list 904, transaction state 906, transaction context 908, andoriginal message 910. Participant list 902 comprises a list of servers.Check list 904 comprises a list used to track received messages fromservers in participant list 902. Transaction state 906 comprises aprepare state or a commit state. In various embodiments, transactionstate 906 comprises a complete state, a done state, or any otherappropriate state for a transaction. Transaction context 908 comprisesactions and conditions associated with the transaction. Original message910 comprises the original transaction request. In some embodiments,transaction conditions comprise conditions associated with a transactionthat must be satisfied in order for the transaction to be allowed.Transaction actions comprise actions that are required to be executedbased on the received request.

FIG. 10 is a block diagram illustrating an embodiment of a balance entryin a database. In some embodiments, the balance entry comprises a datastored in the database. In some embodiments, the balance entry can havesimultaneous updates. In the example shown, balance entry 1000 comprisesgross balance value 1002, reserved amount 1004, update buffer ID 1006,in-commit bit 1008, and latch bit 1010. Gross balance value 1002comprises the value for the balance without respect for activity that iscurrently underway (e.g., a balance remaining on a phone billingaccount—minutes remaining, independent of whether a customer iscurrently on the phone). Reserved amount 1004 comprises the amount ofthe gross balance that has been allocated (reserved) for activity thatis currently underway (e.g., if the customer is on the phone, and 10minutes have been initially allocated for the call, and each minutecosts 10 cents, then $1 of the customer's balance will be reserved).Update buffer ID 1006 comprises a pointer to an update buffer associatedwith the balance value. In-commit bit 1008 comprises a bit that is setin the event that there are transactions in flight against the balance.When set, update buffer ID 1006 contains a pointer value. Latch bit 1010comprises a bit indicating that the balance value and the update bufferassociated with the balance value are latched.

Although the foregoing embodiments have been described in some detailfor purposes of clarity of understanding, the invention is not limitedto the details provided. There are many alternative ways of implementingthe invention. The disclosed embodiments are illustrative and notrestrictive.

1. A system for processing a transaction, comprising: a processorconfigured to check a condition using data in a first database, whereinthe data is associated with a transaction, wherein the data in the firstdatabase is latched before checking the condition and is unlatched afterchecking the condition; the processor is further configured to indicateto a second database to check the condition using data in the seconddatabase, wherein the data is associated with the transaction, whereinthe data in the second database is latched before checking the conditionand is unlatched after checking the condition; and a memory coupled tothe processor and configured to provide the processor with instructions.2. A system as in claim 1, wherein the processor is further configuredto receive an indication that the condition check was satisfied.
 3. Asystem as in claim 1, wherein the condition check using data in a firstdatabase is part is of processing a prepare.
 4. A system as in claim 1,wherein the condition check using data in the second database is part ofprocessing a prepare.
 5. A system as in claim 1, wherein the processoris further configured to determine whether to proceed with processingthe transaction based at least in part on the received condition check.6. A system as in claim 5, wherein in the event that the condition issatisfied, a transaction buffer is allocated.
 7. A system as in claim 6,where in the transaction buffer comprises a transaction condition list.8. A system as in claim 6, where in the transaction buffer comprises atransaction command.
 9. A system as in claim 5, wherein in the eventthat the condition is valid, an update buffer is created or allocated.10. A system as in claim 9, wherein the update buffer comprises amaximum value.
 11. A system as in claim 9, wherein the update buffercomprises a minimum value.
 12. A system as in claim 9, wherein theupdate buffer comprises a number of transactions.
 13. A system as inclaim 1, wherein the processor is further configured to: implement acommit state associated with the transaction in the first database,wherein the data in the first database is latched before implementingthe commit state in the first database and is unlatched after theimplementing of the commit state in the first database; indicate to thesecond database that the commit state is to be implemented in the seconddatabase, wherein the data in the second database is latched beforeimplementing the commit state in the second database and is unlatchedafter the implementing of the commit state in the second database.
 14. Asystem as in claim 13, wherein implementing a commit state comprisesupdating a data.
 15. A system as in claim 13, wherein implementing acommit state comprises updating an update buffer.
 16. A system as inclaim 13, wherein implementing a commit state comprises updating a istransaction buffer.
 17. A method for processing a transaction,comprising: checking a condition using data in a first database, whereinthe data is associated with a transaction, wherein the data in the firstdatabase is latched before checking the condition and is unlatched afterchecking the condition; and indicating to a second database to check thecondition using data in the second database, wherein the data isassociated with the transaction, wherein the data in the second databaseis latched before checking the condition and is unlatched after checkingthe condition.
 18. A computer program product for processing atransaction, the computer program product being embodied in a computerreadable storage medium and comprising computer instructions for:checking a condition using data in a first database, wherein the data isassociated with a transaction, wherein the data in the first database islatched before checking the condition and is unlatched after checkingthe condition; and indicating to a second database to check thecondition using data in the second database, wherein the data isassociated with the transaction, wherein the data in the second databaseis latched before checking the condition and is unlatched after checkingthe condition.